home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
sc3x04.exe
/
SETDDSR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-05-25
|
4KB
|
108 lines
// IMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM;
// : :
// : module: setddsr.c :
// : abstract: This module shows how to make 3.x system calls using :
// : the F2 Shell Interface for the Set Directory Disk :
// : Space Restriction API, obviously it requires the :
// : NetWare Shell. :
// : :
// : This call may need to be made iteratively to return :
// : all of the restriction information. For simplicity, :
// : this example only makes the call once. :
// : :
// : environment: NetWare 3.x v3.11 :
// : Borland C 3.1 :
// : :
// : This software is provided as is and carries no warranty :
// : whatsoever. Novell disclaims and excludes any and all implied :
// : warranties of merchantability, title and fitness for a particular :
// : purpose. Novell does not warrant that the software will satisfy :
// : your requirements or that the software is without defect or error :
// : or that operation of the software will be uninterrupted. You are :
// : using the software at your risk. The software is not a product :
// : of Novell, Inc. or any of subsidiaries. :
// HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM<
//
// This software is considered pre-release and may be used at your own
// risk and has been provided due to the many requests of our cust-
// omers. Support for this module will be provided at the sole
// discretion of Novell, Inc.
//
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
#include <dos.h>
#include <fcntl.h>
#include <sys\types.h>
#include <sys\stat.h>
#include "nwsys.c"
//
// First of all, we define the request structure which is needed for the
// Set Directory Disk Space Restriction API call. This structure is
// laid out according to the System Call documentation.
//
struct REQUEST {
WORD sflen; // length of the structure
BYTE sfcode; // the subfunction code
BYTE dirHandle; // Directory Handle
DWORD diskSpaceLimit;
}Request;
// No reply packet required.
BYTE GetDirectoryHandle(int diskNumber)
{
union REGS regs;
memset(®s, 0, sizeof(regs));
regs.h.ah = 0xe9;
regs.h.al = 0x00;
regs.x.dx = diskNumber;
intdos(®s,®s); // do the Int 21
return(regs.h.al); // return code is in AL
}
int main()
{
int retCode;
int driveNum;
char driveLetter[80];
//
// Build the request buffer
//
Request.sflen = (sizeof Request) ;
Request.sfcode = 0x24; // subfunction code
printf("Enter drive letter: ");
scanf("%s", driveLetter);
if (driveLetter[0] <= 'Z')
driveNum = driveLetter[0] - 'A';
else
driveNum = driveLetter[0] - 'a';
Request.dirHandle = GetDirectoryHandle(driveNum);
printf("Enter disk space restriction: ");
scanf("%ld", &(Request.diskSpaceLimit));
retCode = NWSystemCall(0x16, &Request, sizeof(Request),
NULL, 0);
if (retCode != 0) {
printf("Set Directory Disk Space Restriction call failed. Retcode = %d\n",
retCode);
return(-1);
}
else
printf("Set Directory Disk Space Restriction successful.\n");
return(0);
}